<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改仓库')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-respository-edit" th:object="${wmsRespository}">
            <input name="repoId" th:field="*{repoId}" type="hidden">
            <div class="form-group">    
                <label class="col-sm-3 control-label">仓库地址：</label>
                <div class="col-sm-8">
                    <input name="repoAddress" th:field="*{repoAddress}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
                     <label class="toggle-switch switch-solid">
	                            <input type="checkbox" id="repoStatus" th:checked="${wmsRespository.repoStatus == '0' ? true : false}">
	                            <span></span>
	                        </label>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">面积：</label>
                <div class="col-sm-8">
                    <input name="repoArea" th:field="*{repoArea}" class="form-control" type="text" required>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">描述：</label>
                <div class="col-sm-8">
                    <input name="repoDesc" th:field="*{repoDesc}" class="form-control" type="text">
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "wms/respository";
        $("#form-respository-edit").validate({
            focusCleanup: true
        });
	
        function submitHandler() {
            if ($.validate.form()) {
            	var data = $("#form-respository-edit").serializeArray();
            	var status = $("input[id='repoStatus']").is(':checked') == true ? 0 : 1;		        	
	        	data.push({"name": "repoStatus", "value": status});
                $.operate.save(prefix + "/edit",data);
            }
        }
    </script>
</body>
</html>